package com.zhu.rpc.server.handler;

import com.zhu.rpc.RpcProtocol;
import com.zhu.rpc.server.RpcProtocolProviderBean;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class RpcProtocolDecodeHandler extends ChannelInboundHandlerAdapter {

    Logger logger = LoggerFactory.getLogger(getClass());
    @Override
    public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
        logger.debug("解析请求数据了");
        if (msg instanceof RpcProtocolProviderBean){
            super.channelRead(ctx, RpcProtocol.decode((RpcProtocolProviderBean) msg));
        }

    }
}